extends "../i_TD_core_Hide/i_TD_core_Hide.gd"


func init():
	.init()
	name = "汲取核心"
	resetdata()
	info = info + "核心汲取：当击杀或助攻击杀敌方时，吸取敌方10%生命上限，3%护甲；持续10秒，并使所有技能冷却时间减少1s[cd:10秒]"

func _connect():
	._connect()
	masCha.connect("onCharaDel",self,"run2")

#重置计数
func run2(cha):
	if masCha.isDeath || cha.team == masCha.team || flag2:return
	var statis = ctrl.getStatisByCha(cha)
	var s1 = statis.get(masCha,{"dmg":0,"hurt":0,"heal":0,"name":masCha.name})
	if s1.hurt != 0:
		flag2 = 1
		masCha.addBuff(HXJQ.new(cha.att.maxHp*0.1,cha.att.def*0.03,cha.att.mgiDef*0.03))
		for i in masCha.skills:
			i.nowTime += 1
#时间加速
func _upS():
	._upS()
	if !flag2:return
	cnt3 += 1
	if cnt3 == 10:
		cnt3 = 0
		flag2 = 0

class HXJQ:
	extends Buff
	func _init(hp,d,md):
		attInit()
		life = 10
		id ="HXJQ"
		att.maxHp = hp
		att.def = max(1,d)
		att.mgiDef = max(1,md)